import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        int N = num.nextInt();
        int[] array = new int[N];
        //数组赋值
        for (int i = 0; i < N; i++) {
            array[i] = num.nextInt();
        }
        //有序的数组
        int[] temp = new int[N];
        Arrays.sort(array);
        for (int i = 0; i < N; i++) {
            temp[i] = array[i];
        }

        int k = 0;
        int[] Temp = new int[N];
        for (int i = 0; i < N - 1; i++) {
            int flag = 0;
            for (int j = i + 1; j < N; j++) {
                if (temp[i] == temp[j]) {
                    flag++;
                }
            }
            if (flag == 0) {
                Temp[k] = temp[i];
                k++;
            }
        }
        Temp[k] = temp[N - 1];
        for (int element : Temp) {
            System.out.print(element + " ");
        }

        //错误
        int sum = 0;
        for (int i = 0; i < N - 1; i++) {
            if (Temp[i + 1] - Temp[i] == 1) {
                sum++;
            }
        }

        System.out.println("");
        System.out.print(sum);
    }
}